#include <QApplication>
#include <QSharedPointer>
#include "mainwindow.h"
#include "Abstractcontroller.h"
#include "Controller.h"
#include "Abstractmodel.h"
#include "Model.h"

typedef QSharedPointer<AbstractModel<double> > AbstractModelPtr;
typedef QSharedPointer<AbstractController<double> > AbstractControllerPtr;
typedef QSharedPointer<Observer_I<double> > ObserverPtr;
typedef QSharedPointer<MainWindow> ViewPtr;

int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    AbstractModelPtr ptrModel(new Model());
    AbstractControllerPtr ptrController(new Controller(ptrModel));
    ObserverPtr ptrObserver(new MainWindow(ptrController, nullptr));
    ptrModel.data()->addObserver(ptrObserver);
    ViewPtr ptrView = qSharedPointerDynamicCast<MainWindow>(ptrObserver);
    ptrView.data()->show();
    return a.exec();
    }
